<template>
  <div class="menu">
    <el-menu mode="horizontal" :ellipsis="false" @select="handleSelect">
      <div class="logo">X-Blog</div>
      <div class="flex-grow" />
      <el-sub-menu index="1">
        <template #title>菜单</template>
        <el-menu-item index="/login">登录</el-menu-item>
      </el-sub-menu>
    </el-menu>
  </div>
</template>

<script setup>
import { useRouter } from "vue-router";

const router = useRouter();
const handleSelect = (key, path) => {
  router.push(key);
};
</script>

<style scoped>
.x-header {
  display: flex;
  width: 100%;
  justify-content: left;
}
.flex-grow {
  flex-grow: 1;
}
.logo {
  display: flex;
  height: 100%;
  align-items: center;
}
</style>
